clear
version 7.0
#delimit ;
cd "Z:\interactionmodels\";                       * SET WORKING DIRECTORY;
log using replication\electoralparties_replication_xls.log, replace;

*     ***************************************************************** *;
*     ***************************************************************** *;
*       File-Name:      electoralparties_replication_xls.do             *;
*       Date:           01/09/2007                                      *;
*       Author:         MRG                                             *;
*       Purpose:        Replicate Mozaffar et al. 2003, table 1         *;
*       Input File:     XLS_mozaffar.dta                                *;
*       Output File:    electoralparties_replication_xls.log            *;
*       Data Output:    none                                            *;
*       Previous file:                                                  *;
*       Machine:                                                        *;
*     ****************************************************************  *;
*     ****************************************************************  *;

set mem 10m;

use getdata\XLS_mozaffar.dta;

*     ****************************************************************  *;
*           Summary Statistics                                          *;
*     ****************************************************************  *;

sum;

*     ****************************************************************  *;
*       First, try to replicate Model 1 in Table 1, page 386.           *;
*     ****************************************************************  *;

regress  elecparties_xls logmag10_xls proximity_xls prox_prescandidate_xls;

regress  elecparties_xls logmag_xls proximity_xls prox_prescandidate_xls;

regress  elecparties_xls logmag10_xls proximity_xls prox_prescandidate_xls, robust;

regress  elecparties_xls logmag_xls proximity_xls prox_prescandidate_xls, robust;

*     ****************************************************************  *;
*       Neither of these work                                           *;
*     ****************************************************************  *;


*     ****************************************************************  *;
*       Model 2                                                         *;
*     ****************************************************************  *;

regress elecparties_xls fragmentation_xls concentration_xls frag_conc_xls;

regress elecparties_xls fragmentation_xls concentration_xls frag_conc_xls, robust;

regress elecparties_xls fragmentation2_xls concentration_xls frag_conc_xls;

regress elecparties_xls fragmentation2_xls concentration_xls frag_conc_xls, robust;

regress elecparties_xls fragmentation2_xls concentration_xls frag2_conc_xls;

regress elecparties_xls fragmentation2_xls concentration_xls frag2_conc_xls, robust;

regress elecparties_xls fragmentation_xls fragmentation2_xls concentration_xls frag2_conc_xls, robust;

regress elecparties_xls fragmentation_xls fragmentation2_xls concentration_xls frag_conc_xls, robust;

*     ****************************************************************  *;
*       Could not replicate either, but closest one was with            *;
*       fragmentation2 and frag2_conc.                                  *;
*     ****************************************************************  *;

*     ****************************************************************  *;
*       Model 3                                                         *;
*     ****************************************************************  *;

regress elecparties_xls logmag10_xls proximity_xls prox_prescandidate_xls fragmentation_xls concentration_xls frag_conc_xls;

regress elecparties_xls logmag10_xls proximity_xls prox_prescandidate_xls fragmentation_xls concentration_xls frag_conc_xls, robust;

regress elecparties_xls logmag_xls proximity_xls prox_prescandidate_xls fragmentation_xls concentration_xls frag_conc_xls;

regress elecparties_xls logmag_xls proximity_xls prox_prescandidate_xls fragmentation_xls concentration_xls frag_conc_xls, robust;

regress elecparties_xls logmag10_xls proximity_xls prox_prescandidate_xls fragmentation2_xls concentration_xls frag_conc_xls;

regress elecparties_xls logmag10_xls proximity_xls prox_prescandidate_xls fragmentation2_xls concentration_xls frag_conc_xls, robust;

regress elecparties_xls logmag10_xls proximity_xls prox_prescandidate_xls fragmentation2_xls concentration_xls frag2_conc_xls;

regress elecparties_xls logmag10_xls proximity_xls prox_prescandidate_xls fragmentation2_xls concentration_xls frag2_conc_xls, robust;

regress elecparties_xls logmag_xls proximity_xls prox_prescandidate_xls fragmentation2_xls concentration_xls frag_conc_xls;

regress elecparties_xls logmag_xls proximity_xls prox_prescandidate_xls fragmentation2_xls concentration_xls frag_conc_xls, robust;

regress elecparties_xls logmag_xls proximity_xls prox_prescandidate_xls fragmentation2_xls concentration_xls frag2_conc_xls;

regress elecparties_xls logmag_xls proximity_xls prox_prescandidate_xls fragmentation2_xls concentration_xls frag2_conc_xls, robust;

regress elecparties_xls logmag10_xls proximity_xls prox_prescandidate_xls fragmentation2_xls concentration_xls frag2_conc_xls, robust;

*     ****************************************************************  *;
*       Could not replicate - but last equation is closest.             *;
*     ****************************************************************  *;

*     ****************************************************************  *;
*                               Model 4                                 *;
*     ****************************************************************  *;

regress  elecparties_xls logmag10_xls proximity_xls prox_prescandidate_xls fragmentation_xls concentration_xls logmag10_frag_conc_xls;

regress  elecparties_xls logmag10_xls proximity_xls prox_prescandidate_xls fragmentation_xls concentration_xls logmag10_frag_conc_xls, robust;

regress  elecparties_xls logmag10_xls proximity_xls prox_prescandidate_xls fragmentation2_xls concentration_xls logmag10_frag_conc_xls;

regress  elecparties_xls logmag10_xls proximity_xls prox_prescandidate_xls fragmentation2_xls concentration_xls logmag10_frag_conc_xls, robust;

regress  elecparties_xls logmag10_xls proximity_xls prox_prescandidate_xls fragmentation2_xls concentration_xls logmag10_frag2_conc_xls;

regress  elecparties_xls logmag10_xls proximity_xls prox_prescandidate_xls fragmentation2_xls concentration_xls logmag10_frag2_conc_xls, robust;

regress  elecparties_xls logmag_xls proximity_xls prox_prescandidate_xls fragmentation_xls concentration_xls logmag_frag_conc_xls;

regress  elecparties_xls logmag_xls proximity_xls prox_prescandidate_xls fragmentation_xls concentration_xls logmag_frag_conc_xls, robust;

regress  elecparties_xls logmag_xls proximity_xls prox_prescandidate_xls fragmentation2_xls concentration_xls logmag_frag_conc_xls;

regress  elecparties_xls logmag_xls proximity_xls prox_prescandidate_xls fragmentation2_xls concentration_xls logmag_frag_conc_xls, robust;

gen logmag_frag2_conc_xls = logmag_xls*fragmentation2_xls*concentration_xls;

label var logmag_frag2_conc_xls "logmag*fragmentation2*concentration";

regress  elecparties_xls logmag_xls proximity_xls prox_prescandidate_xls fragmentation2_xls concentration_xls logmag_frag2_conc_xls;

regress  elecparties_xls logmag_xls proximity_xls prox_prescandidate_xls fragmentation2_xls concentration_xls logmag_frag2_conc_xls, robust;

*     ****************************************************************  *;
*      Again, not possible to replicate despite multiple configurations *;
*     ****************************************************************  *;

*     ****************************************************************  *;
*     ****************************************************************  *;
*     ****************************************************************  *;
*       These are the specifications that get us the closest to the     *;
*       results shown in Table 1.                                       *;
*     ****************************************************************  *;
*     ****************************************************************  *;
*     ****************************************************************  *;

*     ****************************************************************  *;
*                               Model 1                                 *;
*     ****************************************************************  *;

regress elecparties_xls logmag10_xls proximity_xls prox_prescandidate_xls, robust;

*     ****************************************************************  *;
*                               Model 2                                 *;
*     ****************************************************************  *;

regress elecparties_xls fragmentation2_xls concentration_xls frag2_conc_xls, robust;

*     ****************************************************************  *;
*                               Model 3                                 *;
*     ****************************************************************  *;

regress elecparties_xls logmag10_xls proximity_xls prox_prescandidate_xls fragmentation2_xls concentration_xls frag2_conc_xls, robust;


*     ****************************************************************  *;
*                               Model 4                                 *;
*     ****************************************************************  *;

regress elecparties_xls logmag10_xls proximity_xls prox_prescandidate_xls fragmentation2_xls concentration_xls logmag10_frag2_conc_xls, robust;

*     ****************************************************************  *;
*     ****************************************************************  *;
*     ****************************************************************  *;
*     ****************************************************************  *;
*                       Correct specifications                          *;
*     ****************************************************************  *;
*     ****************************************************************  *;
*     ****************************************************************  *;
*     ****************************************************************  *;

*     ****************************************************************  *;
*                               Model 1                                 *;
*     ****************************************************************  *;

regress elecparties_xls logmag10_xls proximity_xls prescandidate_xls prox_prescandidate_xls, robust;

*     ****************************************************************  *;
*                               Model 2                                 *;
*     ****************************************************************  *;

regress elecparties_xls fragmentation_xls fragmentation2_xls concentration_xls frag_conc_xls, robust;

*     ****************************************************************  *;
*                               Model 3                                 *;
*     ****************************************************************  *;

regress elecparties_xls logmag10_xls proximity_xls prescandidate_xls prox_prescandidate_xls fragmentation_xls concentration frag_conc_xls, robust;

*     ****************************************************************  *;
*                               Model 4                                 *;
*     ****************************************************************  *;

regress elecparties_xls logmag10_xls proximity_xls prescandidate_xls prox_prescandidate_xls fragmentation_xls concentration_xls
frag_conc_xls logmag10_frag_xls logmag10_conc_xls logmag10_frag_conc_xls, robust;



*     ****************************************************************  *;
*                       End of basic replication                        *;
*     ****************************************************************  *;

log close;
exit;
